package mm.test;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspWriter;

public class MockJspWriter extends JspWriter {

	private MockResponse res;

	public MockJspWriter(MockResponse res) {
		super(1024, true);
		this.res=res;
	}

	public String getContent() {
		return res.getContent();
	}

	public void print(String content) throws IOException {
		((HttpServletResponse)res).getWriter().write(content);
	}

	public void write(char[] arg0, int arg1, int arg2) throws IOException {
		((HttpServletResponse)res).getWriter().write(arg0, arg1, arg2);
	}

	public void write(String content) throws IOException {
		((HttpServletResponse)res).getWriter().write(content);
	}

	@Override
	public void clear() throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void clearBuffer() throws IOException {
		; // FIXME do nothing?
	}

	@Override
	public void close() throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void flush() throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public int getRemaining() {
		throw new UnsupportedOperationException();
	}

	@Override
	public void newLine() throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void print(boolean arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void print(char arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void print(int arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void print(long arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void print(float arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void print(double arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void print(char[] arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void print(Object arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void println() throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void println(boolean arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void println(char arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void println(int arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void println(long arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void println(float arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void println(double arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void println(char[] arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void println(String arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	@Override
	public void println(Object arg0) throws IOException {
		throw new UnsupportedOperationException();
	}

	// lots of uninteresting methods elided.  I just gave them
	// degenerate implementations.  (e.g. {})
}
